1 using System.Collections;
2 using
System.Collections.Generic;
3 using
UnityEngine;
4
5 public
class MusicPlayer : MonoBehaviour {
6     
static MusicPlayer instance = null;
7     
// Use this for initialization
8
9     
void Awake()
10     {
11         Debug.Log(
"Music player Awake " + GetInstanceID());
12         
if (instance != null)
13         {
14             Destroy(gameObject);
15             print(
"Duplicate music player self-destructing!");
16         }
17         
else
18         {
19             instance =
this;
20             GameObject.DontDestroyOnLoad(gameObject);
21         }
22     }
23
24     
void Start()
25     {
26         Debug.Log(
"Music player Start " + GetInstanceID());
27     }
28         
29     
30     
// Update is called once per frame
31     
void Update () {
32         
33     }
34 }


Gõ tìm kiếm nhanh...